package com.gonsin.gview.logic.services;

import com.gonsin.gview.annotations.GContext;
import com.gonsin.gview.logic.config.GViewDynamicViewService;
import com.gonsin.gview.logic.parser.DynamicModelHolder;
import com.gonsin.gview.logic.parser.DynamicViewParser;
import com.gonsin.gview.model.GViewModel;
import com.gonsin.gview.model.dynamic.DynamicView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class GViewDynamicViewImpl implements GViewDynamicViewService {

    @Autowired private DynamicViewParser parser;
    @Autowired private GViewCoreServiceImpl coreService;

    private List<DynamicModelHolder> prepareBoardList = new ArrayList<>();



    @Override
    public void addDynamicView(String viewName, DynamicView view) {
//        GContext context = new GContext(viewName);
//        GViewModel model = parser.parse(context, view);
        prepareBoardList.add(new DynamicModelHolder(viewName, view, parser));
    }

    @Override
    public List<DynamicModelHolder> getDynamicViews() {
        return prepareBoardList;
    }
}
